reduce is package{
  contract reduce over %t determines %a is {
    reducer has type ((%a,%b)=>%b) => ((%t, %b)=>%b);
    reducel has type ((%b,%a)=>%b) => ((%b, %t)=>%b);
  }
 
  implementation reduce over cons of %t determines %t is {
    reducer(f) is (function(x,z) is foldr(f,z,x));
    reducel(f) is (function(x,z) is foldl(f,x,z));
  }
  
  foldr(f,z,nil) is z;
  foldr(f,z,cons(x,xs)) is f(x,foldr(f,z,xs));
  
  foldl(f,z,nil) is z;
  foldl(f,z,cons(x,xs)) is foldl(f,f(z,x),xs);
}